﻿@{
    ViewBag.Title = "Index.Mobile";
}

<style>
    .ui-datebox-controls span.ui-btn-inner {
        padding-bottom: 28px !important;
    }

    .ui-datebox-controls a span.ui-btn-inner {
        padding-bottom: 10px !important;
    }

    .ui-datebox-controls div {
        width: 70px !important;
        margin: 0 0.2em !important;
    }
    .Search {

        background-image: url(@Url.Content("~/Content/images/icon-search-black.png")) !important;
        background-repeat: no-repeat;
        background-position: 98% 50%;
        outline: 0;
    }

    input.Search::-webkit-calendar-picker-indicator {
  display: none;
}
</style>

<script type="text/javascript">

    //Check Code Logic start
     @Html.Raw(Model.FormJavaScript)
    //Check code logic end

    var isShift = false;


    function DateFormat(txt, keyCode) {
        if (keyCode == 16)
            isShift = true;

        if (txt.value.length == 10 && keyCode != 8 && keyCode != 46) {
            return false;
        }

        //Validate that its Numeric
        if (keyCode < 65 || (keyCode > 90 && keyCode < 97) || keyCode > 122) {

            return true;
        }
        else {
            return false;
        }
    }

    function ValidateDate(txt, keyCode) {
        if (keyCode == 16)
            isShift = false;
        var val = txt.value;

        if (val.length == 10) {
            var splits = val.split("/");
            var dt = new Date(splits[0] + "/" + splits[1] + "/" + splits[2]);

            //Validation for Dates
            if (dt.getDate() == splits[1] && dt.getMonth() + 1 == splits[0]
                && dt.getFullYear() == splits[2]) {

            }
            else {
                alert("Invalid Date");

                return;
            }


        }
        else if (val.length < 10) {
            alert("Required mm/dd/yyyy format. Slashes will come up automatically.");
        }
    }

</script>

<script type="text/javascript">

    //   $(function () {
    //           $("#savediv button[title]").tooltip();
    //       });
</script>
<script type="text/javascript">



    /*Clicking the continue button*/

    function Submit() {

        $('#myform').submit();

    }

    function Continue() {
        //debugger;
        var presentUrl;
        var pageNumber;
        var actionUrlC;
        presentUrl = '@Url.Action("Index","Survey")';
        pageNumber = '@Model.CurrentPage';
        actionUrlC = processUrl(presentUrl, 'ContinueUrl', pageNumber);
        $("#myform")[0].action = actionUrlC;
        $("#myform").submit();

    }

    /*Clicking the previous button*/
    function Previous() {
        //debugger;
        var presentUrl;
        var pageNumber;
        var actionUrlP;
        presentUrl = '@Url.Action("Index","Survey")';
        pageNumber = '@Model.CurrentPage';
        actionUrlP = processUrl(presentUrl, 'PreviousUrl', pageNumber);
        $("#myform")[0].action = actionUrlP;
        $("#myform").submit();
    }

    $(document).bind('mobileinit', function () {
        $.mobile.selectmenu.prototype.options.nativeMenu = false;
        alert();
    });

    $(document).ready(function () {
        // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!

        //$("#Savebutton").tooltip();



        //  $( "#myform" ).validate();

        ////
        //alert('');
        //$("select").attr('data-role', 'main');
        //$("select").attr('data-native-menu', 'false');
        //$("select").selectmenu('refresh');
        // $.mobile.selectmenu.prototype.options.nativeMenu = false;

        ////

        $("#dialog").dialog({
            autoOpen: false,
            show: "blind",
            hide: "blind",
            resizable: false,
            height: 370,
            modal: true
        });

        $("#VideoDialog").dialog({
            autoOpen: false,
            show: "blind",
            hide: "blind",
            resizable: false,
            height: 410,
            width: 500,
            modal: true
        });

        var responseUrl = GetRedirectionUrl();
        // $('#url').val(responseUrl);
        $('#url').val('@Model.RedirectURL');

        var passcode = '@Model.PassCode';
        $('#spPassCode').text(passcode);

        //        if ('@Model.IsSaved' == 'True') {

        //            if ('@Model.StatusId' == '1') { //if clicking the save button for the first time
        //                $('#successContent').show();
        //                $('#successContent').append('<div class="success"><div class="image"><img src="@Url.Content("~/Content/images/button_check.png")" style="vertical-align:middle; padding-right: 5px;  width:24px;" alt=""/></div><div class="message">Your survey has been saved.<p style="text-align:left;  margin-top:4px; margin-bottom:2px;"><button id="copy" type="button" name="copy" class="copylink">Get Survey Link & Pass Code</button></p></div><div style="clear:both;"></div></div>')

        //

        //                //call your jquery modal popup method
        //                $("#dialog").dialog("open");
        //
        //            }
        //            else {

        //

        //                $('#successContent').show(); //in subsequest click we just show that the survey has been saved not the modal popup
        //                $('#successContent').append('<div class="success"><div class="image"><img src="@Url.Content("~/Content/images/button_check.png")" style="vertical-align:middle; padding-right: 5px;  width:24px;" alt=""/></div><div class="message">Your survey has been saved.<p style="text-align:left; margin-top:4px; margin-bottom:2px;"><button id="copy" type="button" name="copy" class="copylink">Get Survey Link & Pass Code</button></p></div><div style="clear:both;"></div></div>')
        //            }
        //            return true;
        //        }

    });

    $(document).ready(function () {





        $("#send").click(function () {

            var emailAddress = $("#email").val();
            var confirmemail = $("#confirmemail").val();
            var redirectUrl = GetRedirectionUrl();
            //var surveyName = $("#_surveyName").val();
            var surveyName = '@Model.SurveyInfo.SurveyName';
            surveyName = "H";//ReplaceString(surveyName);
            var passCode = $('#spPassCode').text();
            //url to post for email to be sent
            var postUrl = '@Url.Action("Notify","Post")';
            var EmailSubject = $('#Subject').val();
            EmailSubject = "H";//ReplaceString(EmailSubject);
            if (ValidateEmail(emailAddress) && ValidateEmail(confirmemail)) {
                if ($.trim(emailAddress) == $.trim(confirmemail)) {
                    //Call notify function to send notification
                    NotifyByEmail(emailAddress, redirectUrl, surveyName, postUrl, passCode, EmailSubject);
                    //close the modal popup after processing
                    $("#dialog").dialog("close");
                }
                else {
                    alert("The email address did not match.");
                }

            }
            else {
                // $('#email').after('<span class="error">Enter a valid email address.</span>');
                alert('Enter a valid email address!');
            }
        });




        /*Open the modal popup on link click*/
        $('#copy').click(function () {
            $("#dialog").dialog("open");
            // $('#url').val(GetRedirectionUrl());
            $('#url').val('@Model.RedirectURL');

            return false;
        });

        ///////Update Controls State Start///////
        //     CCE_Set_Update_HighlightedControls_State(document.getElementById("HighlightedFieldsList").value );
        //         CCE_Set_Update_DisabledControls_State(document.getElementById("DisabledFieldsList").value);
        ///////Update Controls State end///////



        ///////////Adding Red Border for none valid controls start ///////////////////

        $('.SelectNotValid').find('.ui-btn').css("border-color", "red");
        $('.TimePickerNotValid').find('.ui-input-datebox').css("border-color", "red");
        $('.DatePickerNotValid').find('.ui-input-datebox').css("border-color", "red");

        ///////////Adding Red Border for none valid controls end ///////////////////

        /////////////////////Save Start///////////////////////

        var IsSaved = document.getElementById("HiddenIsSaved").value;
        var StatusId = document.getElementById("HiddenStatusId").value;

        var Subject = "Link for Survey: " + '@Model.SurveyInfo.SurveyName';
        var passcode1 = '@Model.PassCode';
        //if (StatusId == 'false' && '@Model.StatusId' != '2' ) { //if clicking the save button for the first time

        if ('@Model.IsSaved' == 'True') {


            if ('@Model.StatusId' == '1') { //if clicking the save button for the first time
         
                $('#Savebutton1').simpledialog2({
                    'mode': 'blank',
                    'prompt': false,
                    'forceInput': false,
                    'useModal': true,
                    'buttons': {
                        'OK': {
                            click: function () {
                                $('#dialogoutput').text('OK');
                            }
                        }

                    },
                    'blankContent': "<div class='success'><div class='image'><img src='../../Content/images/button_check.png' style='vertical-align: middle; padding-right:5px; width:24px;'alt=''/></div><div class='message' style='width:85% !important;'>Your Survey has been saved.</div><div style='clear:both;'></div></div>  <p><span style='font-weight:bold;'>Survey Link:</span><br /><textarea " + "value=" + GetRedirectionUrl().toString() + "  id='url' cols='65'  class='surveryLinkTxtArea' readonly='readonly'>" + GetRedirectionUrl().toString() + "</textarea></p><p style='font-weight:bold;'>Pass Code: <span id='spPassCode' class='passcodeBox1'>" + passcode1 + "</span></p> <hr/> <p>Enter your email address to have the Survey Link and Pass Code emailed to you.</p><p><span style='font-weight:bold;'>Email Subject:</span><br /><textarea id='Subject' cols='65'  style='  height:30px;  white-space:pre; border:1px solid #aecfea; padding:4px; margin-top:4px;'>" + Subject + "</textarea></p><p><label for='email' style='font-weight:bold;'>Email:</label> <input id='email' type='email' /></p>  <p><label for='confirmemail'style='font-weight:bold;'>Confirm Email:</label> <input id='confirmemail' type='email' /><div align='center'> <a  onclick ='SendEmail();'  class='login'  style='width:50px; padding:8px 15px !important;'>Send Email</a></div></p>  <br /> <p style='font-size: 8pt; padding: 5px; background: #ffffa8; margin-top:-5px;'><strong>Note:</strong> Your email address will not be saved and will only be used to send you the survey link.</p>"
                })

            }

        }
        if ('@Model.StatusId' == '2' && document.getElementById("HiddensuccessContent").value == "false") {
            document.getElementById("HiddensuccessContent").value = "true";
            $('#successContent').show();
            $('#successContent').append('<div class="success"><div class="image"><img src="@Url.Content("~/Content/images/button_check.png")" style="vertical-align:middle; padding-right: 5px; width:24px" alt=""/></div><div class="message"> Your survey has been saved.<p style="text-align:left; margin-top:4px; margin-bottom:2px;"><button id="Savebutton2" type="button"  class="copylink">Get Survey Link & Pass Code</button></p></div><div style="clear:both;"></div></div>')

        }


        ////////////////////Save End/////////////////////////


    });
    function SendEmail() {

        var emailAddress = $("#email").val();
        var confirmemail = $("#confirmemail").val();
        var redirectUrl = GetRedirectionUrl();
        //var surveyName = $("#_surveyName").val();
        var surveyName = '@Model.SurveyInfo.SurveyName';
        surveyName = ReplaceString(surveyName).toString();
        var passCode = $('#spPassCode').text();
        var EmailSubject = $('#Subject').val();
        EmailSubject = ReplaceString(EmailSubject).toString();
        //url to post for email to be sent
        var postUrl = '@Url.Action("Notify","Post")';
        if (ValidateEmail(emailAddress) && ValidateEmail(confirmemail)) {
            if ($.trim(emailAddress) == $.trim(confirmemail)) {
                //Call notify function to send notification
                NotifyByEmail(emailAddress, redirectUrl, surveyName, postUrl, passCode, EmailSubject);
                //close the modal popup after processing
                $("#dialog").dialog("close");
            }
            else {
                alert("The email address did not match.");
            }

        }
        else {
            // $('#email').after('<span class="error">Enter a valid email address.</span>');
            alert('Enter a valid email address!');
        }

    }

    function updateXml(pName, pValue) {



        var UpdateUrl = '@Url.Action("UpdateResponseXml","Survey")';
        var NList = "";
        for (var i = 0; i < NameList.length; i++) {
            if (NList == "") {
                NList = NameList[i]
            } else {
                NList = NList + "," + NameList[i];
            }

        }
        UpdateResponse(UpdateUrl, NList, pValue, '@Model.ResponseId');

    }
    /*Clicking the save button to save the survey*/
    function Save() {
        var DisabledFieldsList = $('#DisabledFieldsList').val();

        if (DisabledFieldsList.length > 0) {
            CCE_ProcessEnableAllControls(DisabledFieldsList);
        }

        //SaveSurvey();
        //debugger;
        //set the is_save_action hidden variable value to true to indicate that save button has been clicked
        $("#myform")[0].is_save_action.value = 'true';
        //set the action path of the current form so when it is submitted by clicking the save button it posts to the path
        $("#myform")[0].action = window.location.href;
        //detach the validation engine as we don't want to validate data on save button click
        $('#myform').validationEngine('detach');
        //posting the form
        $('#myform').submit();
        // return false;

    }
    function SaveSurvey() {

        var StatusId = document.getElementById("HiddenStatusId").value;
        if ((StatusId == 'false' || '@Model.StatusId' == '1') && '@Model.StatusId' != '2') {
            var UpdateUrl = '@Url.Action("SaveSurvey", "Survey")';
            SaveAndUpdate(UpdateUrl, "PageNumber", '@Model.CurrentPage', '@Model.ResponseId');
        }
    }
    // save button dialog

    $(document).delegate('#Savebutton1', 'click', function () {

        //   var IsSaved  =  document.getElementById("HiddenIsSaved").value;
        //   var StatusId = document.getElementById("HiddenStatusId").value;
        //
        //    var Subject ="Link for Survey: " + '@Model.SurveyInfo.SurveyName' ;
        //    var passcode1 = '@Model.PassCode';
        //    if (StatusId == 'false' && '@Model.StatusId' != '2' ) { //if clicking the save button for the first time
        //
        //                    $('#successContent').show();
        //                    $('#successContent').append('<div class="success"><div class="image"><img src="@Url.Content("~/Content/images/button_check.png")" style="vertical-align:middle; padding-right: 5px;  width:24px;" alt=""/></div><div class="message">Your survey has been saved.<p style="text-align:left; margin-top:4px; margin-bottom:2px;"><button id="Savebutton2" type="button" name="copy" class="copylink">Get Survey Link & Pass Code</button></p></div><div style="clear:both;"></div></div>')

        //                         $(this).simpledialog2({
        //                'mode' : 'blank',
        //                'prompt': false,
        //                'forceInput': false,
        //                'useModal':true,
        //                'buttons' : {
        //                              'OK': {
        //                                click: function () {
        //                                  $('#dialogoutput').text('OK');
        //                                }
        //                              }
        //
        //                            },
        //                      'fullHTML': "<div class='success'><div class='image'><img src='../../Content/images/button_check.png' style='vertical-align: middle; padding-right:5px; width:24px;'alt=''/></div><div class='message' style='width:85% !important;'>Your Survey has been saved.</div><div style='clear:both;'></div></div>  <p><span style='font-weight:bold;'>Survey Link:</span><br /><textarea " + "value=" + GetRedirectionUrl().toString() + "  id='url' cols='65'  style='  height:45px;  white-space:pre; background:#d6e7f5; border:1px solid #aecfea; padding:4px; margin-top:4px;' readonly='readonly'>" + GetRedirectionUrl().toString() + "</textarea></p><p style='font-weight:bold;'>Pass Code: <span id='spPassCode' style='font-size:12pt; background:#d6e7f5; border:1px solid #aecfea; padding:4px 10px;'>" + passcode1 + "</span></p> <hr/> <p>Enter your email address to have the Survey Link and Pass Code emailed to you.</p><p><span style='font-weight:bold;'>Email Subject:</span><br /><textarea id='Subject' cols='65'  style='  height:30px;  white-space:pre; border:1px solid #aecfea; padding:4px; margin-top:4px;'>" + Subject +"</textarea></p><p><label for='email' style='font-weight:bold;'>Email:</label> <input id='email' type='email' /></p>  <p><label for='confirmemail'style='font-weight:bold;'>Confirm Email:</label> <input id='confirmemail' type='email' /><div align='center'> <a  onclick ='SendEmail();'  class='login'  style='width:50px; padding:8px 15px !important;'>Send Email</a></div></p>  <br /> <p style='font-size: 8pt; padding: 5px; background: #ffffa8; margin-top:-5px;'><strong>Note:</strong> Your email address will not be saved and will only be used to send you the survey link.</p>"
        //                         })

        //                 }
        //                 if ('@Model.StatusId' == '2' && document.getElementById("HiddensuccessContent").value == "false"){
        //                    document.getElementById("HiddensuccessContent").value = "true";
        //                    $('#successContent').show();
        //                    $('#successContent').append('<div class="success"><div class="image"><img src="@Url.Content("~/Content/images/button_check.png")" style="vertical-align:middle; padding-right: 5px; width:24px" alt=""/></div><div class="message"> Your survey has been saved.<p style="text-align:left; margin-top:4px; margin-bottom:2px;"><button id="Savebutton2" type="button"  class="copylink">Get Survey Link & Pass Code</button></p></div><div style="clear:both;"></div></div>')

        //                 }


    });



    $(document).delegate('#Savebutton2', 'click', function () {

        var passcode1 = '@Model.PassCode';
        var Subject = "Link for Survey: " + '@Model.SurveyInfo.SurveyName';

        $(this).simpledialog2({
            'mode': 'blank',
            'prompt': false,
            'forceInput': false,
            'useModal': true,
            'buttons': {
                'OK': {
                    click: function () {
                        $('#dialogoutput').text('OK');
                    }
                }

            },
            'blankContent': "<div class='success'><div class='image'><img src='../../Content/images/button_check.png' style='vertical-align: middle; padding-right:5px; width:24px;'alt=''/></div><div class='message' style='width:85% !important;'>Your Survey has been saved.</div><div style='clear:both;'></div></div>  <p><span style='font-weight:bold;'>Survey Link:</span><br /><textarea " + "value=" + GetRedirectionUrl().toString() + "  id='url' cols='65' class='surveryLinkTxtArea' readonly='readonly'>" + GetRedirectionUrl().toString() + "</textarea></p><p style='font-weight:bold;'>Pass Code: <span id='spPassCode' class='passcodeBox1'>" + passcode1 + "</span></p> <hr/> <p>Enter your email address to have the Survey Link and Pass Code emailed to you.</p><p><span style='font-weight:bold;'>Email Subject:</span><br /><textarea id='Subject' cols='65'  style='  height:30px;  white-space:pre; border:1px solid #aecfea; padding:4px; margin-top:4px;'>" + Subject + "</textarea></p><p><label for='email' style='font-weight:bold;'>Email:</label> <input id='email' type='email' /></p>  <p><label for='confirmemail' style='font-weight:bold;'>Confirm Email:</label> <input id='confirmemail' type='email' /><div align='center'> <a  onclick ='SendEmail();'  class='login'  style='width:50px; padding:8px 15px !important;'>Send Email</a></div></p>  <br /> <p style='font-size: 8pt; padding: 5px; background: #ffffa8; margin-top:-5px;'><strong>Note:</strong> Your email address will not be saved and will only be used to send you the survey link.</p>"
        })




    });



    $(document).delegate('#close', 'click', function () {

        $(this).simpledialog2({
            'mode': 'blank',
            'headerText': "Exit Survey",
            //   'prompt': "tste",
            'forceInput': false,
            'useModal': true,
            'buttons': {
                'OK': {
                    click: function () {
                        $('#dialogoutput').text('OK');
                    }
                }

            },
            'blankContent': "<div id=\"exitdialog\" title=\"Exit Survey\" ><p style=\"font-size:1.0em; font-weight:600;\">Are you sure you want to exit this Survey? </p><p style=\"font-size:1.0em; font-weight:300;\">Any unsaved changes will be lost!<br /></p><p><div align='right'> <a  onclick ='ExitSurvey();'  class='login'  style='width:50px; padding:8px 15px !important;'>Exit Survey</a>        <a class='login'  style='width:50px; padding:8px 15px !important;'rel='close'   id='simpleclose'>Cancel</a></div></p>"
        })

    });


    function CloseDialog() {


        $(this).dialog("close");

    }
    /*Exit the survey */
    function ExitSurvey() {

        var signoutUrl = '@Url.Action("SignOut","Post")';
        //var homePageUrl = '@Url.Action("Index","Home")' + '/' + '@Model.SurveyInfo.SurveyId';
        var homePageUrl = '@System.Configuration.ConfigurationManager.AppSettings["ExitURL"]'
        if (homePageUrl == "" || homePageUrl == " " || homePageUrl == null) {
            homePageUrl = '@Url.Action("Index","Home")' + '/' + '@Model.SurveyInfo.SurveyId';
        }

        SignOutAndRedirect(signoutUrl, homePageUrl);
    }



    $(function () {
        $('#myform').submit(function () {

            var DisabledFieldsList = $('#DisabledFieldsList').val();
            //alert(" " + DisabledFieldsList);
            if (DisabledFieldsList.length > 0) {
                CCE_ProcessEnableAllControls(DisabledFieldsList);
            }
            return true;
        });
    });


    function ReplaceString(string) {

        return string.replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, "\"").replace(/&#39;/g, "'");
    }


    function SetCodes_Val(obj, SurveyId, TableName, AutoComplete) {


        $('#' + obj.id).val(obj.value);
        var availableTags = [obj.value];
        var signoutUrl = "";
        if (AutoComplete) {
            signoutUrl = '@Url.Action("GetCodesValue","Survey")' + '?SourceTableName=' + TableName + '&SelectedValue=' + obj + '&SurveyId=' + SurveyId;
        } else {
            signoutUrl = '@Url.Action("GetCodesValue","Survey")' + '?SourceTableName=' + TableName + '&SelectedValue=' + obj.value + '&SurveyId=' + SurveyId;
        }

        $.ajax({
            url: signoutUrl,
            type: 'GET',
            contentType: 'application/json; charset=utf-8',
            dataType: "json",
            async: false,
            success: successFunc,
            error: errorFunc
        });


        function successFunc(data, status) {

            $.each(data, function (key, value) {
                var Query = "#mvcdynamicfield_" + key;
                // alert(Query);
                $(Query).val(value);
            });
        }

        function errorFunc() {
            alert('error');
        }


    }

    function GetAutoComplete_Val(obj, SurveyId, TableName) {

        var availableTags = new Array();
        var signoutUrl = '@Url.Action("GetAutoCompleteList", "Survey")' + '?SourceTableName=' + TableName + '&SelectedValue=' + obj.value + '&SurveyId=' + SurveyId;

        $.ajax({
            url: signoutUrl,
            type: 'GET',
            contentType: 'application/json; charset=utf-8',
            dataType: "json",
            async: false,
            success: successFunc,
            error: errorFunc
        });


        function successFunc(data, status) {
            var Query = "#mvcdynamicfield_" + TableName;
            $.each(data, function (key, value) {
                //debugger;
                availableTags.push(value);


            });

            $(Query).autocomplete({
                source: availableTags,
                select: function (event, ui) {

                    SetCodes_Val(ui.item.label, SurveyId, TableName, true);
                },
            });
        }

        function errorFunc() {
            alert('error');
        }


    }

</script>

<div id="header">
    <h1>
        @Model.SurveyInfo.SurveyName

    </h1>
</div>


<div id="infobox">
    <div id="pages" class="pages">



        @if (Model.NumberOfPages > 0)
        {
            int num = 0;



            for (int i = 1; Model.NumberOfPages > i - 1; i++)
            {

                num = i;
                if (i == 1 && Model.CurrentPage > 1)
                {
                    <a onclick="Submit();" href="@Url.RouteUrl(null, new { controller = "Survey", action = "Index", responseid = Model.ResponseId, PageNumber = Model.CurrentPage - 1 })" class="nextprev prevArrow" title="Previous Page">
                        &nbsp;&nbsp;&nbsp;
                    </a>
                    @* <a href="@Url.RouteUrl(null, new { controller = "Survey", action = "Index", responseid = Model.ResponseId, PageNumber = Model.CurrentPage - 1 })" onclick="Submit();" data-role="button" data-inline="true" data-theme="e" data-mini="true" data-icon="arrow-l"
                        data-iconpos="notext"  >
                        Previous</a>*@

                }

                if (Model.CurrentPage == i)
                {
                    <span class="current">@num of @Model.NumberOfPages</span>
                }


            }

            if (Model.CurrentPage != Model.NumberOfPages)
            {


                <a id="anchorNext" onclick="Submit();" href="@Url.RouteUrl(null, new { controller = "Survey", action = "Index", responseid = Model.ResponseId, PageNumber = Model.CurrentPage + 1 })" class="nextprev nextArrow" title="Go to Next Page">
                    &nbsp;&nbsp;&nbsp;
                </a>
                @*   <a id="anchorNext" onclick="Submit();"  href="@Url.RouteUrl(null, new { controller = "Survey", action = "Index", responseid = Model.ResponseId, PageNumber = Model.CurrentPage + 1 })" data-role="button" data-inline="true" data-theme="e" data-mini="true" data-icon="arrow-r" data-iconpos="notext">
                    Next
                    </a>*@


            }

        }




    </div>

    <div align="right">
        @*<button  class="MobileExitSurvey"    type="submit" id="close">Exit Survey</button>*@
        <button type="button" onclick="Save();" id="Savebutton1" name="Savebutton" value="save" data-role="button" data-theme="save23" data-inline="true" data-iconpos="notext"></button>
        <a id="close" class="exitsurvey">Exit</a>
        @* <a id="close" class="exitsurvey" onclick="Submit();"  href="@Url.RouteUrl(null, new { controller = "Home", action = "Index", SurveyId = Model.SurveyInfo.SurveyId })">Exit</a>*@
    </div>
    <div style="clear: both;">
    </div>
</div>
@*<div id="content">*@
<div id="successContent">
</div>

@if (!string.IsNullOrEmpty(Model.GetErrorSummary()))
{
    <div class="errormsg">
        <div class="image">
            <img src="@Url.Content("~/Content/images/error.png")" style="vertical-align: middle; padding-right: 5px; width:24px;" alt="" />
        </div>
        <div class="message">
            <span style="font-weight: bold; font-size: 10pt;">
                Please correct the following errors
                before continuing:
            </span>
            <br />
            @Html.Raw(Model.GetErrorSummary())
        </div>
        <div style="clear: both;">
        </div>
    </div>
}

@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "myform", @class = @Model.IsDraftModeStyleClass.ToString() }))
{


    @Html.AntiForgeryToken()


    @Html.Raw(Model.RenderHtml(true))




    <input type="hidden" id="HiddenFieldsList" name="HiddenFieldsList" value="@Model.HiddenFieldsList" />
    <input type="hidden" id="HighlightedFieldsList" name="HighlightedFieldsList" value="@Model.HighlightedFieldsList" />
    <input type="hidden" id="DisabledFieldsList" name="DisabledFieldsList" value="@Model.DisabledFieldsList" />
    <input type="hidden" id="RequiredFieldsList" name="RequiredFieldsList" value="@Model.RequiredFieldsList" />
    <input type="hidden" id="AssignList" name="AssignList" value="@Model.AssignList" />
    <input type="hidden" name="is_save_action" value="false" />
    <input type="hidden" name="is_goto_action" value="false" />

    <input type="hidden" name="HiddenStatusId" id="HiddenStatusId" value="false" />
    <input type="hidden" name="HiddenIsSaved" id="HiddenIsSaved" value="false" />
    <input type="hidden" name="HiddensuccessContent" id="HiddensuccessContent" value="false" />

    <div id="nav">
        <div id="pagesbottom">
            <div id="prev" align="left">
                &nbsp;
                @if (Model.CurrentPage != 1)
                {
                    <a onclick="Submit();" style="" href="@Url.RouteUrl(null, new { controller = "Survey", action = "Index", responseid = Model.ResponseId, PageNumber = Model.CurrentPage - 1 })" class="prev" title="Previous Page">&nbsp;</a>
                    @* <button class="prev" id="PreviousButton" value="PreviousButton" onclick="Previous();"  name="PreviousButton"  type="button" > &nbsp; Previous</button>*@
                }
            </div>

            <div id="savediv" align="center">
                @*<a  onclick="Save();" style="" class="save" title="Click this button to finish the survey later. Use the survey link and pass code provided to return to the survey at a later time.">&nbsp;</a> *@
                <button type="button" onclick="Save();" id="Savebutton1" name="Savebutton" value="save" data-role="button" data-theme="save1" data-inline="true" data-iconpos="notext"></button>
                @*onclick="Save();"*@
            </div>

            @if (Model.CurrentPage == Model.NumberOfPages)
            {
                <div id="next" align="right" style="margin-top:-8px !important;">
                    @*<a  name="Submitbutton" onclick="Submit();" class="submits" >Submit</a>*@
                    <button data-role="button" data-theme="submit1" data-inline="true" type="submit" name="Submitbutton" value="Submit">Submit</button>
                </div>
            }
            else
            {
                <div id="next" align="right">
                    <a onclick="Submit();" style="" href="@Url.RouteUrl(null, new { controller = "Survey", action = "Index", responseid = Model.ResponseId, PageNumber = Model.CurrentPage + 1 })" class="next" title="Next Page">&nbsp;</a>
                    @*<button class="next"  name="ContinueButton" id="ContinueButton" onclick="Continue();" type="button" >Continue &nbsp; </button>*@
                </div>
            }
        </div>
    </div>

}
@* </div>*@ @*<div id="dialog" title="Your Survey has been saved." data-role="popup">
                   <p>Please copy and save the <span style="font-weight:bold;">Survey Link</span> and <span style="font-weight:bold;">Pass Code</span> in order to return to the survey at a later time.</p>
                <p><span style="font-weight:bold;">Survey Link:</span><br /><textarea id="url" cols="65"  style="  height:30px;  white-space:pre; background:#d6e7f5; border:1px solid #aecfea; padding:4px; margin-top:4px;" readonly="readonly"></textarea></p>

               <p style="font-weight:bold;">Pass Code: <span id="spPassCode" style="font-size:12pt; background:#d6e7f5; border:1px solid #aecfea; padding:4px 10px;"></span></p>
                  <hr/>
                  <p>Optionally enter your email address to have the Survey Link and Pass Code emailed to you.</p>



                <p><label for="email">Email:</label> <input id="email" type="text" style="width: 200px; margin-left:48px;"/></p>
                  <p><label for="confirmemail">Confirm Email:</label> <input id="confirmemail" type="text" style="width: 200px;"/>
                  <button id="send" type="button" class="login" style="width:50px">Send</button></p>
                <br />
                <p style="font-size: 8pt; padding: 5px; background: #ffffa8; margin-top:-5px;"><strong>Note:</strong> Your email address will not be saved and will only be used to send you the survey link.</p>
    </div>
*@
